#include "work4.h"
#include "ui_work4.h"
#include "mainwindow.h"
#include "main.h"
#include <string>
#include <cstring>
#include "client_mode.h"
work4::work4(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::work4)
{
    ui->setupUi(this);
}

work4::~work4()
{
    delete ui;
}

void work4::on_pushButton_clicked()
{
    std::string order_id = ui->lineEdit->text().toStdString();
    const char *id = order_id.c_str();
    logistic_info *item;
    item = l_first;
    while(item){
        if(!strcmp(item->order_id, id)){
            ui->lineEdit_2->setText(QString(item->Courier_company));
            ui->lineEdit_3->setText(QString(item->logistic_id));
            ui->lineEdit_4->setText(QString(item->now_addr));
            ui->lineEdit_5->setText(QString(item->label));
            break;
        }
        else item = item->next;
    }
    if(!item){
        ui->lineEdit_2->setText(QString("None"));
        ui->lineEdit_3->setText(QString("None"));
        ui->lineEdit_4->setText(QString("None"));
        ui->lineEdit_5->setText(QString("None"));
    }
}
